package com.dd.logistics.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dd.logistics.entity.Customer;
import com.dd.logistics.mapper.CustomerMapper;
import com.dd.logistics.service.CustomerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
    
    @Override
    public Customer getByName(String name) {
        QueryWrapper<Customer> wrapper = new QueryWrapper<>();
        wrapper.eq("name", name);
        return this.getOne(wrapper);
    }
    
    @Override
    @Transactional
    public boolean updateCustomerInfo(Customer customer) {
        if (customer.getId() != null) {
            return this.updateById(customer);
        }
        return false;
    }
} 